package com.dwxt.parabolic.controller;

import com.dwxt.common.base.BaseResult;
import com.dwxt.parabolic.service.AreaService;
import org.hibernate.validator.internal.constraintvalidators.bv.time.past.PastValidatorForYear;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/parabolic/area")
@RestController
public class AreaController {
    @Autowired
    private AreaService areaService;

    /**
     * 查询一级区域
     */
    @RequestMapping("/list/first")
    public BaseResult getOneLevelArea() {
        return areaService.getOneLevelArea();
    }
    /**
     * 根据父级id 查询子级区域
     */
    @RequestMapping("/list/children")
    public BaseResult getByParentId(String parentId){
        return areaService.getByParentId(parentId);
    }
    /**
     *根据id查询数据
     */
    @RequestMapping("/selectByKey")
    public BaseResult selectByKey(String id){
        return BaseResult.ok(areaService.selectByPrimaryKey(id));
    }
}
